package com.bole.controller;


import com.alibaba.fastjson.JSON;
import com.bole.dao.CarDao;
import com.bole.dto.car.TbCarDto;
import com.bole.pojo.TbCarDo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController()
@RequestMapping("sellingCars")
@Api(value = "我要卖车")
public class SellingCarsController {

    @Autowired
    private CarDao carDao;


    @PostMapping("sellCar")
    @ApiOperation(value = "卖车",notes = "卖车")
    @ApiImplicitParam(name = "carDo",value = "卖车",required = true,dataTypeClass = TbCarDo.class)
    public void  sellCar(@RequestBody TbCarDo carDo) {
        //点击我要卖车
        //判断是否登录
        //没登陆，提示登录
        //登录
        //增加
        //审核状态为未审核
        carDo.setStatus(0);
        //创建时间为当前时间
        carDo.setCreateTime(new Date());
        //手机号为注册手机号
        //卖家id
        TbCarDo save = carDao.save(carDo);
        TbCarDto carDto = new TbCarDto();
        BeanUtils.copyProperties(save,carDto);
    }


}
